Page({
  data: {
    parkInfo: {
      id: 1,
      name: '中心公园',
      description: '城市中心的绿色明珠，占地面积200亩，配备完善的休闲健身设施。',
      imageUrl: '/assets/images/park1.jpg',
      images: [
        '/assets/images/park1.jpg',
        '/assets/images/park2.jpg',
        '/assets/images/park3.jpg'
      ],
      openTime: '06:00-22:00',
      address: '城市中心区域滨江大道1号',
      phone: '027-12345678',
      facilities: [
        { name: '停车场', icon: '/assets/icons/parking.png' },
        { name: '卫生间', icon: '/assets/icons/wc.png' },
        { name: '休息区', icon: '/assets/icons/rest.png' },
        { name: '健身区', icon: '/assets/icons/fitness.png' }
      ],
      latitude: 30.593116,
      longitude: 114.305649
    }
  },

  onLoad(options) {
    const { id } = options
    // TODO: 根据id获取公园详情
    this.getParkDetail(id)
  },

  // 获取公园详情
  getParkDetail(id) {
    // TODO: 调用获取公园详情API
  },

  // 预览图片
  onPreviewImage(e) {
    const { current } = e.currentTarget.dataset
    wx.previewImage({
      current,
      urls: this.data.parkInfo.images
    })
  },

  // 打电话
  onCall() {
    const { phone } = this.data.parkInfo
    wx.makePhoneCall({
      phoneNumber: phone
    })
  },

  // 导航
  onLocation() {
    const { latitude, longitude, name, address } = this.data.parkInfo
    wx.openLocation({
      latitude,
      longitude,
      name,
      address
    })
  },

  // 返回上一页
  onBack() {
    wx.navigateBack({
      delta: 1
    })
  }
}) 